define('formLeave',['text!../tpl/form-leave.html','tool','common'],function(Template,tool,common){
    var App ={
    	template:Template,
    	mixins: [tool.toor,common.common],
    	data:function(){
    		return{
    			submitJson:{
				    "component": [
					    {
	    			   	  "name":"请假类型",
	    			   	  "value":''
	    			   },
	    			   {
	    			   	   "name": "开始时间",
					       "value": ''
	    			   },
	    			   {
	    			   	   "name": "结束时间",
					       "value": ''
	    			   },
	    			   {
	    			   	   "name": "请假天数",
					       "value": ''
	    			   },
	    			   {
	    			   	   "name": "请假事由",
					       "value": ''
	    			   }
				    ]
				},
				typess:[
				{text:'va',value:'va'}],
				inputtest:''
    		};
    	},
    	mounted:function(){
    		var _this=this;
    		$("#job").select({
			  title: "请假类型",
			  items: ['请选择','事假','病假','带薪假','调休','婚假','产假','陪产假','路途假','其他','产假','丧假'],
			  onOpen:function(){
			  
			  	document.querySelector('#app').style.overflowY='hidden';
			  },
			  onClose:function()
			  {
			  	document.querySelector('#app').style.overflowY='auto';
			  },
			  onChange:function(data){
			  	console.log(data);
			  	 _this.submitJson.component[0].value=data.values;
			  }
			});
    	},
    	watch:{
    		submitJson:
    		{
    			handler: function (val, oldVal) {
    				if(val.component[1].value)
    				{
    					val.component[1].value=new Date(val.component[1].value).Format('yyyy-MM-dd');
    				};
    				if(val.component[2].value)
    				{
    					val.component[2].value=new Date(val.component[2].value).Format('yyyy-MM-dd');
    				};
    			},
                deep: true
    		},
    		inputtest:function(val)
    		{
    			console.log('watch',val);
    		}
    	},
    	methods:
    	{
    		
    	}
    };
    return {
        app:App       
    };
});